<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <title>医生列表</title>
  <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css">
  <link rel="stylesheet" href="../../static/css/style.css" th:href="@{/css/style.css}"/>
</head>
<body>
<div th:replace="~{common/layout :: header}"></div>
<div th:replace="~{common/layout :: sidebar}"></div>
<div class="container mt-5">
  <h1 class="mb-4">医生列表</h1>
  <a href="/doctors/add" class="btn btn-primary mb-3">添加新医生</a>
  <hr>
  <table class="table table-bordered">
    <thead class="thead-dark">
    <tr>
      <th>医生编号</th>
      <th>姓名</th>
      <th>性别</th>
      <th>部门号</th>
      <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <tr th:each="doctor : ${doctors}">
      <td th:text="${doctor.docCode}"></td>
      <td th:text="${doctor.realName}"></td>
      <td th:text="${doctor.sex == 1 ? '男' : '女'}"></td>
      <td th:text="${doctor.deptno}"></td>
      <td>
        <a th:href="@{/doctors/view/{id}(id=${doctor.docId})}" class="btn btn-info btn-sm">查看</a>
        <a th:href="@{/doctors/edit/{id}(id=${doctor.docId})}" class="btn btn-warning btn-sm">编辑</a>
        <a th:href="@{/doctors/delete/{id}(id=${doctor.docId})}" class="btn btn-danger btn-sm" onclick="return confirm('确定要删除该医生吗？');">删除</a>
      </td>
    </tr>
    </tbody>
  </table>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>
